<?php
	
	$db = new mysql_db($config->get('dbhost'), $config->get('dbuser'),  $config->get('dbpass'), $config->get('dbname'), false);
		
	add_database($db, $db_name);

	// CLASES MODELO DE NEGOCIO	
	class Categoria_laboral extends BusinessObject
	{
		function Categoria_laboral ()
		{
			$this->table_name = "gc_categoria_laboral";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class Categoria_laboralCollection extends BusinessObjectCollection
	{
		function Categoria_laboralCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Categoria_laboral();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Convenio_colectivo extends BusinessObject
	{
		function Convenio_colectivo ()
		{
			$this->table_name = "gc_convenio_colectivo";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"rubro" => array("varchar"),
					"numero" => array("varchar"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class Convenio_colectivoCollection extends BusinessObjectCollection
	{
		function Convenio_colectivoCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Convenio_colectivo();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Planta extends BusinessObject
	{
		function Planta()
		{
			$this->table_name = "gc_planta";
			$this->field_metadata = array(
					"id" => array("int"),
					"denominacion" => array("varchar"),
					"direccion" => array("varchar"),
					"id_provincia" => array("int"),
					"id_localidad" => array("int"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class PlantaCollection extends BusinessObjectCollection
	{
		function PlantaCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Planta();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Rubro extends BusinessObject
	{
		function Rubro ()
		{
			$this->table_name = "gc_rubro";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class RubroCollection extends BusinessObjectCollection
	{
		function RubroCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Rubro();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Area extends BusinessObject
	{
		function Area ()
		{
			$this->table_name = "gc_area";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"id_planta" => array("int"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class AreaCollection extends BusinessObjectCollection
	{
		function AreaCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Area();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Empresa extends BusinessObject
	{
		function Empresa ()
		{
			$this->table_name = "gc_empresa";
			$this->field_metadata = array(
					"id" => array("int"),
					"razon_social" => array("varchar"),
					"cuit" => array("varchar"),
					"direccion" => array("varchar"),
					"id_provincia" => array("int"),
					"id_localidad" => array("int"),
					"email" => array("varchar"),
					"telefono" => array("varchar"),
					"observaciones" => array("varchar"),
					"forzado_rrhh" => array("char"),
					"forzado_excep" => array("char"),
					"id_tipo_ingreso" => array("int"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class EmpresaCollection extends BusinessObjectCollection
	{
		function EmpresaCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Empresa();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Vehiculo extends BusinessObject
	{
		function Vehiculo()
		{
			$this->table_name = "gc_vehiculo";
			$this->field_metadata = array(
					"id" => array("int"),
					"patente" => array("varchar"),
					"detalle" => array("varchar"),
					"id_empresa" => array("varchar"),
					"itv" => array("char"),
					"itv_fec_venc" => array("date"),
					"vtv" => array("char"),
					"vtv_fec_venc" => array("date"),
					"tuv" => array("char"),
					"tuv_fec_venc" => array("date"),
					"id_poliza_seguro" => array("int"),
					"poliza_seguro_fec_vig" => array("date"),
					"poliza_seguro_fec_venc" => array("date"),
					"habilitado" => array("char"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class VehiculoCollection extends BusinessObjectCollection
	{
		function VehiculoCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Vehiculo();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Contratista extends BusinessObject
	{
		function Contratista()
		{
			$this->table_name = "gc_contratista";
			$this->field_metadata = array(
					"id" => array("int"),
					"dni" => array("varchar"),
					"apellido" => array("varchar"),
					"nombre" => array("varchar"),
					"id_categoria_laboral" => array("int"),
					"id_convenio_colectivo" => array("int"),
					"vto_contrato_trabajo" => array("date"),
					
					"id_empresa" => array("varchar"),
					"cuil" => array("varchar"),
					"fecha_alta" => array("date"), 
					"habilitado" => array("char"),
					
					//"curso_induccion" => array("varchar"),
					"id_rubro" => array("int"),
					"id_planta" => array("int"),
					"actividad" => array("varchar"),
					
					/*
					"capacitacion" => array("varchar"),
					"fecha_capacitacion" => array("date"),
					*/
					//"a_conducir" => array("varchar"),
					"id_modulo_capacitacion" => array("varchar"),
					"fecha_capacitacion" => array("date"),
					"vigencia_capacitacion" => array("int"),
					
					"nro_contrato_art" => array("varchar"),
					"id_empresa_art" => array("int"),
					"vto_poliza_art" => array("date"),
					"vto_clausula_art" => array("date"),
					
					"id_empresa_acc_pers" => array("varchar"),
					"vto_poliza_acc_pers" => array("date"),
					"vto_pago_poliza_acc_pers" => array("date"),
					
					"id_seguro_vida" => array("int"),
					"vto_poliza_seguro_vida" => array("date"),
					
					"foto" => array("varchar"),
					
					"carnet_conducir" => array("char"),
					"vto_carnet_conducir" => array("date"),
					"id_categoria_carnet" => array("varchar"),
					
					"carnet_especial" => array("char"),
					"vto_carnet_especial" => array("date"),
					
					"id_examen_medico" => array("int"),
					"fecha_presentacion" => array("date"),
					"vigencia_examen" => array("int"),
					"calificacion" => array("int"),
					"fecha_calificacion" => array("date"),
					"vigencia_calificacion" => array("int"),
					"user_id" => array("int"),
					"card_id" => array("int"),
					"card_custom_id" => array("varchar"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class ContratistaCollection extends BusinessObjectCollection
	{
		function ContratistaCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Contratista();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Modulo_capacitacion extends BusinessObject
	{
		function Modulo_capacitacion()
		{
			$this->table_name = "gc_modulo_capacitacion";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class Modulo_capacitacionCollection extends BusinessObjectCollection
	{
		function Modulo_capacitacionCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Modulo_capacitacion();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Examen_medico extends BusinessObject
	{
		function Examen_medico()
		{
			$this->table_name = "gc_examen_medico";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class Examen_medicoCollection extends BusinessObjectCollection
	{
		function Examen_medicoCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Examen_medico();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	
	class Empresa_art extends BusinessObject
	{
		function Empresa_art()
		{
			$this->table_name = "gc_empresa_art";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class Empresa_artCollection extends BusinessObjectCollection
	{
		function Empresa_artCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Empresa_art();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	
	class Empresa_acc_pers extends BusinessObject
	{
		function Empresa_acc_pers()
		{
			$this->table_name = "gc_empresa_acc_pers";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class Empresa_acc_persCollection extends BusinessObjectCollection
	{
		function Empresa_acc_persCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Empresa_acc_pers();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}

	class Empresa_seguro_vida extends BusinessObject
	{
		function Empresa_seguro_vida()
		{
			$this->table_name = "gc_empresa_seguro_vida";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class Empresa_seguro_vidaCollection extends BusinessObjectCollection
	{
		function Empresa_seguro_vidaCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Empresa_seguro_vida();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class CategoriaCarnet extends BusinessObject
	{
		function CategoriaCarnet()
		{
			$this->table_name = "gc_categoria_carnet";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class CategoriaCarnetCollection extends BusinessObjectCollection
	{
		function CategoriaCarnetCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new CategoriaCarnet();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Poliza_seguro extends BusinessObject
	{
		function Poliza_seguro ()
		{
			$this->table_name = "gc_poliza_seguro";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class Poliza_seguroCollection extends BusinessObjectCollection
	{
		function Poliza_seguroCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Poliza_seguro();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	
	class Tipo_ingreso extends BusinessObject
	{
		function Tipo_ingreso ()
		{
			$this->table_name = "gc_tipo_ingreso";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class Tipo_ingresoCollection extends BusinessObjectCollection
	{
		function Tipo_ingresoCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Tipo_ingreso();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Documento extends BusinessObject
	{
		function Documento ()
		{
			$this->table_name = "gc_documento";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"prioridad" => array("char"),
					"id_tipo_documento" => array("int"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class DocumentoCollection extends BusinessObjectCollection
	{
		function DocumentoCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Documento();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Tipo_documento extends BusinessObject
	{
		function Tipo_documento()
		{
			$this->table_name = "gc_tipo_documento";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class Tipo_documentoCollection extends BusinessObjectCollection
	{
		function Tipo_documentoCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Tipo_documento();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Periodo extends BusinessObject
	{
		function Periodo()
		{
			$this->table_name = "gc_periodo";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class PeriodoCollection extends BusinessObjectCollection
	{
		function PeriodoCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Periodo();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Medio_recepcion extends BusinessObject
	{
		function Medio_recepcion()
		{
			$this->table_name = "gc_medio_recepcion";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class Medio_recepcionCollection extends BusinessObjectCollection
	{
		function Medio_recepcionCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Medio_recepcion();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	
	class EmpresaDocumento extends BusinessObject
	{
		function EmpresaDocumento()
		{
			$this->table_name = "gc_empresa_documento";
			$this->field_metadata = array(
					"id" => array("int"),
					"id_empresa" => array("int"),
					"id_planta" => array("int"),
					"fecha_recepcion" => array("date"),
					"fecha_vencimiento" => array("date"),
					"caja" => array("varchar"),
					"id_periodo" => array("int"),
					"id_medio_recepcion" => array("int"),
					"id_documento" => array("int"),
					"observacion" => array("varchar"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class EmpresaDocumentoCollection extends BusinessObjectCollection
	{
		function EmpresaDocumentoCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new EmpresaDocumento();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	
	class Tipo_aviso extends BusinessObject
	{
		function Tipo_aviso()
		{
			$this->table_name = "gc_tipo_aviso";
			$this->field_metadata = array(
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"cant_dias" => array("int"),
					"vigente" => array("char")
				);
			parent::BusinessObject();
		}
	}

	class Tipo_avisoCollection extends BusinessObjectCollection
	{
		function Tipo_avisoCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Tipo_aviso();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Aviso extends BusinessObject
	{
		function Aviso()
		{
			$this->table_name = "gc_aviso";
			$this->field_metadata = array(
					"id" => array("int"),
					"id_empresa" => array("int"),
					"fecha" => array("date"),
					"id_tipo_aviso" => array("int"),
					"id_estado_aviso" => array("int"),
					"fecha_aviso" => array("date")
					
				);
			parent::BusinessObject();
		}
	}

	class AvisoCollection extends BusinessObjectCollection
	{
		function AvisoCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Aviso();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Documento_aviso extends BusinessObject
	{
		function Documento_aviso()
		{
			$this->table_name = "gc_documento_aviso";
			$this->field_metadata = array(
					"id" => array("int"),
					"id_aviso" => array("int"),
					"id_documento" => array("int")
				);
			parent::BusinessObject();
		}
	}

	class Documento_avisoCollection extends BusinessObjectCollection
	{
		function Documento_avisoCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Documento_aviso();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	
	
	
	class Localidad extends BusinessObject
	{
		function Localidad()
		{
			$this->table_name = "gc_localidad";
			$this->field_metadata = array(				
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"activo" => array("char")
					
				);
			parent::BusinessObject();
		}
	}


	class LocalidadCollection extends BusinessObjectCollection
	{
		function LocalidadCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Localidad();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	
	class Provincia extends BusinessObject
	{
		function Provincia()
		{
			$this->table_name = "gc_provincia";
			$this->field_metadata = array(				
					"id" => array("int"),
					"descripcion" => array("varchar"),
					"activo" => array("char")
					
				);
			parent::BusinessObject();
		}
	}


	class ProvinciaCollection extends BusinessObjectCollection
	{
		function ProvinciaCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Provincia();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	class Configuracion extends BusinessObject
	{
		function Configuracion ()
		{
			$this->table_name = "gc_configuracion";
			$this->field_metadata = array(
					"id" => array("int"),
					"direccion" => array("varchar"),
					"telefono" => array("varchar"),
					"nombre" => array("varchar")
				);
			parent::BusinessObject();
		}
	}
	
	
	
	
	// CLASES DESOPORTE SISTEMA
	class respaldo extends BusinessObject
	{
		function respaldo()
		{
			$this->table_name = "gc_respaldo";
			$this->field_metadata = array(
					"id" => array("int"),
					"fecha" => array("date"),
					"activo" => array("char")
				);
			parent::BusinessObject();
		}
	}
	
	class Usuarios extends BusinessObject
	{
		function Usuarios()
		{
			$this->table_name = "gc_usuarios";
			$this->field_metadata = array(
					"id" => array("int"),
					"id_usuario" => array("varchar"),
					"clave" => array("varchar"),
					"nom_usuario" => array("varchar"),
					"ape_usuario" => array("varchar"),
					"activo" => array("char"),
					"fec_alta" => array("datetime"),
				);
			parent::BusinessObject();
		}
	}

	class UsuariosCollection extends BusinessObjectCollection
	{
		function UsuariosCollection()
		{
			parent::BusinessObjectCollection();
		}
		
		function create_singular($row) 
		{ 
			$obj = new Usuarios();
			$obj->load_from_list($row);
			
			return $obj;
		}
	}
	
	// CLASES SOPORTE SQL 
	class SqlPersonalizado extends SqlSoporte
	{
		function SqlPersonalizado($h, $u, $p)
		{
			parent::SqlSoporte($h, $u, $p);
		}
	}
	
	
	
	
?>